#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    char arr1[1001];
    int arr2[1001];
    int i = 0;
    do
    {
        arr1[i] = getchar();
        i++;
    } while (arr1[i - 1] != ' ');
    arr1[i - 1] = '\0';
    int b;
    scanf("%d", &b);
    int x = 0;
    int y = 0;
    int c = 0;
    do
    {
        c = arr1[x] - '0';
        c += 10 * y;
        arr2[x] = c / b;
        y = c % b;
        x++;
    } while (arr1[x] != '\0');
    if (arr2[0] == 0)
    {
        if (x == 1)
        {
            printf("0");
        }
        else
        {
            for (int m = 1; m < x; m++)
            {
                printf("%d", arr2[m]);
            }
        }

    }
    else
    {
        for (int m = 0; m < x; m++)
        {
            printf("%d", arr2[m]);
        }
    }
    printf(" %d", y);
}